package com.mg.controller;

import com.github.pagehelper.PageInfo;
import com.mg.dto.PurchaseRecordDto;
import com.mg.dto.SimpleResult;
import com.mg.model.PurchaseRecord;
import com.mg.service.PurchaseRecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * Created by mg1213 on 2018/3/18.
 */
@Controller
@RequestMapping("/purchaseRecord")
public class PurchaseRecordController {
    @Autowired
    private PurchaseRecordService purchaseRecordService;

    @RequestMapping(value = "/user/selectPageInfo")
    @ResponseBody
    public PageInfo<PurchaseRecordDto> selectUserPageInfo(PurchaseRecordDto dto, int limit, int start) {
        return purchaseRecordService.selectPageInfo(dto, start, limit);
    }
    @RequestMapping(value = "/admin/selectPageInfo")
    @ResponseBody
    public PageInfo<PurchaseRecordDto> selectPageInfo(PurchaseRecordDto dto, int limit, int start) {
        return purchaseRecordService.selectPageInfo(dto, start, limit);
    }
    @RequestMapping(value = "/admin/insertPurchaseRecord")
    @ResponseBody
    public SimpleResult insertPurchaseRecord(PurchaseRecord record) {
        return purchaseRecordService.insertPurchaseRecord(record);
    }
    @RequestMapping(value = "/admin/updatePurchaseRecord")
    @ResponseBody
    public SimpleResult updatePurchaseRecord(PurchaseRecord record) {
        return purchaseRecordService.updatePurchaseRecord(record);
    }
    @RequestMapping(value = "/admin/deletePurchaseRecord")
    @ResponseBody
    public SimpleResult deletePurchaseRecord(String ids) {
        return purchaseRecordService.deletePurchaseRecord(ids);
    }

}
